import { getRankListRequest } from '@/api/request'
import * as actionTYpes from './constance'

export const changeLoading=(data)=>(
    {
        type:actionTYpes.CHANGE_LOADING,
        data
    }
)

export const changeRankList=(data)=>({
    type:actionTYpes.CHANGE_RANK_LIST,
    data
})

export const getRankList=()=>{
    return dispatch=>{
        getRankListRequest()
            .then(data=>{
                let list=data && data.list
                dispatch(changeRankList(list))
                dispatch(changeLoading(false))
            })
    }
}